FROM golang:alpine AS builder

WORKDIR /usr/local/app/
COPY . /usr/local/app/
RUN go env -w GOPROXY=https://goproxy.cn,direct \
    && go mod tidy \
    && go build -o assets_api assets-api/assetsapi.go

FROM alpine:latest

WORKDIR /usr/local/app/

COPY --from=builder  /usr/local/app/assets_api ./
COPY --from=builder  /usr/local/app/assets-api/etc/assetsapi.yaml ./
RUN chmod +x assets_api
EXPOSE 88
ENTRYPOINT ["./assets_api"]
CMD ["-f", "assetsapi.yaml"]